package com.qf.dao;

import com.qf.pojo.entity.TbUserRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface TbUserRoleRepository extends JpaRepository<TbUserRole,Integer> {
    @Query(value = "SELECT roleid FROM tb_user_role WHERE userid = ?1",nativeQuery = true)
    List<Integer> findRoleIdByUserId(Integer id);
    @Modifying
    @Transactional
    @Query(value = "delete from tb_user_role where userid = ?1",nativeQuery = true)
    void deleteByUserId(Integer id);
}
